import { AssetInfo } from "../@types/packages/asset-db/@types/public";
import { createMVC } from "./mvc_creator";

export function onAssetMenu(assetInfo: AssetInfo) {
    return [
        {
            label: 'i18n:mvc_creator.menu.generate_script',
            enabled: isPrefab(assetInfo),
            submenu: [
                {
                    label: 'i18n:mvc_creator.menu.create_script_mvc',
                    click() {
                        console.log('create mvc');
                        // console.log(assetInfo);
                        createMVC(assetInfo,"Model");
                        createMVC(assetInfo,"View");
                        createMVC(assetInfo,"VC");
                    },
                },
                {
                    label: 'i18n:mvc_creator.menu.create_script_vc',
                    click() {
                        console.log('create vc');
                        // console.log(assetInfo);
                        createMVC(assetInfo,"View");
                        createMVC(assetInfo,"VC");
                    },
                },
            ],
        },
    ];
};

function isPrefab(assetInfo:AssetInfo){
    return assetInfo.type === 'cc.Prefab';
}
